package com.hhd.pdf.component.table;

import lombok.Getter;
import lombok.Setter;
import org.dom4j.Attribute;
import org.dom4j.Element;

import java.util.LinkedList;
import java.util.List;

@Getter
@Setter
public class TableVo {
    List<TrVo> header = new LinkedList<>();
    List<TrVo> body = new LinkedList<>();
    List<TrVo> footer = new LinkedList<>();
    Element element;

    public List<TrVo> getTrs() {
        LinkedList<TrVo> res = new LinkedList<>();
        res.addAll(header);
        res.addAll(body);
        res.addAll(footer);
        return res;
    }

    public boolean hasBorder() {
        try {
            Attribute border = element.attribute("border");
            if (border.getValue().equals("false")) {
                return false;
            }
        } catch (Exception e) {
        }
        return true;
    }
}
